package bookmanage.Opreation;

import bookmanage.Book;
import bookmanage.BookDao;

import java.util.Scanner;

//添加书籍
public class AddOperation implements IOperation {
    @Override
    public void work() {
        Scanner scanner = new Scanner(System.in);
        BookDao bookDao = new BookDao();
        Book book = new Book();
        System.out.println("请输入添加书籍的名字：");
        String name = scanner.next();
        book.setName(name);
        System.out.println("请输入添加书籍的作者：");
        String author = scanner.next();
        book.setAuthor(author);
        System.out.println("请输入添加书籍的类型：");
        String type = scanner.next();
        book.setType(type);
        System.out.println("请输入添加书籍的价钱：");
        int price = scanner.nextInt();
        book.setPrice(price);
        System.out.println("请输入添加书籍的借出信息：");
        boolean isBorrowed = scanner.nextBoolean();
        book.setBorrowed(isBorrowed);
        bookDao.add(book);
    }
}
